package com.trs.zk.common.mybatis.mapper.query;

/**
 * @author msy
 * @date 2018/8/11 17:37
 */
public enum QueryType {
    EQ("="),
    NE("!="),
    GT(">"),
    GTE(">="),
    LT("<"),
    LTE("<="),
    IN("IN"),
    NOT_IN("NOT IN"),
    LIKE("LIKE", "%", "%"),
    LEFT_LIKE("LIKE", "%", ""),
    RIGHT_LIKE("LIKE", "", "%"),
    IS_NULL("IS NULL"),
    IS_NOT_NULL("IS NOT NULL"),

    // 强制条件，不管值是不是空字符串都加载这个查询条件
    EQ_FORCE("=", true),
    NE_FORCE("!=", true);


    /** 操作符 后缀**/
    private String valueSuffix = "";
    /** 操作符 前缀**/
    private String valuePrefix = "";
    /** 操作符 **/
    private String operator = "";
    private Boolean isForce = true;

    private QueryType(String operator){
        this.operator = operator;
    }

    private QueryType(String operator, String valuePrefix, String valueSuffix) {
        this.operator = operator;
        this.valuePrefix = valuePrefix;
        this.valueSuffix = valueSuffix;
    }

    private QueryType(String operator, Boolean isForce){
        this.operator = operator;
        this.isForce = isForce;
    }

    public Boolean isForce() {
        return this.isForce;
    }

    public String valuePrefix() {
        return this.valuePrefix;
    }

    public String operator() {
        return this.operator;
    }

    public String valueSuffux() {
        return this.valueSuffix;
    }

}
